跳到主要内容

AddReply

Adds a reply to a comment.

Syntax

expression.AddReply(sText, sAuthorName, sUserId, nPos);

expression - A variable that represents a ApiComment class.

Parameters

NameRequired/OptionalData typeDefaultDescription
sTextRequiredStringThe comment reply text (required).
sAuthorNameRequiredStringThe name of the comment reply author (optional).
sUserIdRequiredStringThe user ID of the comment reply author (optional).
nPosOptionalNumberthis.GetRepliesCount()The comment reply position.

Returns

ApiComment

Example

This example adds a comment and makes a reply for it.

let doc = Api.GetDocument();
let paragraph = doc.GetElement(0);
paragraph.AddText("This is just a sample text");
Api.AddComment(paragraph, "comment", "John Smith");
let comments = doc.GetAllComments();
comments[0].AddReply("reply1", "Mark Potato", "uid-2", 0);